$min: 200;
$max: 800;

.box {
    display: grid;
    // grid-template-columns: repeat(4, 1fr);
    grid-template-columns: repeat(4, 1fr);
    // grid-template-rows: masonry;
    gap: 10px;
}

@for $i from 1 through 10 {
    $randomNumber: floor(random() * ($max - $min) + $min);
    .box .imgItem:nth-child(#{$i}) {
        width: $randomNumber + px;
        height: $randomNumber + px;
        background: red;
        border: 1px solid #ccc;
    }
}